﻿using System.Collections.ObjectModel;
using System.Windows.Controls;
using iStudio.Structure.Wave;

namespace iStudio.Structure.Control.Audio.Editor
{
    public class EditorCachedTrack
    {
        //
        // Pointers
        //

        protected readonly WaveTrack Track;
        protected readonly EditorCore EditorCore;

        //
        // Cached chunks of the track
        //

        protected readonly ObservableCollection<EditorCachedChunk> EditorCachedChunks;

        public EditorCachedTrack (WaveTrack track, EditorCore editorCore)
        {
            EditorCachedChunks = new ObservableCollection<EditorCachedChunk> ();
            Track = track;
            EditorCore = editorCore;
        }

        /// <summary>
        /// Sets canvas property elements
        /// </summary>
        /// <param name="property"></param>
        /// <param name="value"></param>
        public virtual void SetCanvasProperty(EditorCanvasProperty property, double value)
        {
            foreach (EditorCachedChunk chunk in EditorCachedChunks)
            {
                chunk.SetCanvasProperty (property, value);
            }
        }
    }
}
